import { BasicColumn, FormSchema } from '/@/components/Table';
import { commonStatusDict, commonStatusDictMap } from '/@/utils/dict';

export const columns: BasicColumn[] = [
  {
    title: '岗位编码',
    dataIndex: 'postCode',
  },
  {
    title: '岗位名称',
    dataIndex: 'postName',
  },
  {
    title: '排序',
    dataIndex: 'sort',
  },
  {
    title: '备注',
    dataIndex: 'remark',
  },
  {
    title: '状态',
    dataIndex: 'status',
    dictFormat: commonStatusDictMap,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'postCode',
    label: '岗位编码',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'postName',
    label: '岗位名称',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'status',
    label: '状态',
    component: 'Select',
    componentProps: {
      options: commonStatusDict,
    },
    colProps: { span: 6 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: 'ID',
    component: 'Input',
    show: false,
  },
  {
    field: 'postCode',
    label: '岗位编码',
    component: 'Input',
    required: true,
  },
  {
    field: 'postName',
    label: '岗位名称',
    component: 'Input',
    required: true,
  },
  {
    field: 'sort',
    label: '排序',
    component: 'Input',
    defaultValue: 100,
    required: true,
  },
  {
    field: 'status',
    label: '状态',
    component: 'RadioButtonGroup',
    defaultValue: 1,
    componentProps: {
      options: commonStatusDict,
    },
  },
  {
    field: 'remark',
    label: '备注',
    component: 'InputTextArea',
  },
];
